Add natural logarithm (ln) unary operator to calculator#1
Open
Add natural logarithm (ln) unary operator to calculator#1
Conversation
Co-authored-by: sdley <102539941+sdley@users.noreply.github.com>
Co-authored-by: sdley <102539941+sdley@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add ln button for natural logarithm operation
Add natural logarithm (ln) unary operator to calculator
Nov 5, 2025
sdley
approved these changes
Nov 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
lnas a unary operation that computes the natural logarithm immediately when pressed, without requiring a second operand.Changes
UI (
public/index.html)lnbutton before the^buttonClient (
public/client.js)lncase tocalculate()switch statement mapping to?operation=lnoperationPressed()to detectlnand immediately callcalculate(operand1, 0, 'ln')Server (
api/controller.js)lnoperation:ln: function (a) { return Math.log(Number(a)); }operand2check whenoperation === 'ln'Usage
Tests for the
lnoperation can be added in a follow-up PR.Original prompt
Create a new branch named
add-ln-buttonand open a pull request againstmainthat implements an "ln" (natural logarithm) unary operation. Changes to make:Replace the calculator-buttons block content with the same structure but with the ln button inserted before the ^ button. The rest of the file should remain unchanged.
Provide the final content of public/index.html (only the file content to write) matching the existing project layout but including the new button. Use the existing <script src="client.js"></script> and body onLoad handler.
?operation=lnin the URI.Provide the full updated public/client.js file content to be written.
Provide the full updated api/controller.js file content to be written.
Additional notes for the PR description (include in the PR body):
Commit message: "Add ln (natural log) button and server/client support"
Branch name: add-ln-button
Please create the branch, commit the three updated files, and open a pull request with the title and description above.
Files to change (final contents to write):